import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

  const routes = [
    {
      path: '/',
      redirect:"/index"
    },
  {
    path: '/index',
    name: 'Index',
    component: () => import( '../views/index.vue')
  },
  {
    path: '/search',
    name: 'Search',
    component: () => import( '../views/search.vue')
  },
  {
    path: '/detail',
    name: 'Detail',
    component: () => import( '../views/detail.vue')
  },
  {
    path: '/cars',
    name: 'Cars',
    component: () => import( '../views/cars.vue')
  },
  {
    path: '/settlement',
    name: 'Settlement',
    component: () => import( '../views/settlement.vue')
  },
  {
    path: '/personalcenter',
    name: 'Personalcenter',
    component: () => import( '../views/personalcenter.vue')
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import( '../views/login.vue')
  }
]

const router = new VueRouter({
  routes
})

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

export default router
